let db = require( '../db/db' );

const tableName = 'core.org_member';

exports.getorg = async function ( userId ) {

    let sql = `select * from ${ tableName } where user_id = $1 limit 1`;

    let params = [userId];

    try {

        let result = await db.runSql( sql, params );

        if ( result.rows.length ) {
            return result.rows[0];
        }
        return null;

    } catch ( e ) {
        console.error( "查询组织信息出错" );
        return null;
    }
}
